#coding= UTF-8
try:
    import socket, sys, traceback, threading, time, subprocess
    import wx
    import Frame


    # lib = subprocess.Popen("cmd")
    lib = subprocess.Popen("main.exe", stdin=subprocess.PIPE, stdout=subprocess.PIPE)

    while True:

        # x, y = map(int, input().split(" "))

        # lib.stdin.write(bytes("move 1 %d %d\r\n"%(x, y), "ascii"))

        # lib.stdin.flush()

        # line = lib.stdout.readline()

        # print(str(line))
        
        line = lib.stdout.readline().decode()

        print(line)

        lib.stdin.write(bytes("excute 1\r\n", "ascii"))

        lib.stdin.flush()

        line = lib.stdout.readline().decode()

        print(line)

    # print()

    # for line in lib.stdout:
    #     print(line)

    # for x in dir(lib.stdin):
    #     print(x)

    # def move(current, x, y):
    #     lib.stdin.write(bytes("move %d %d %d\n"%(current, x, y)))
    #     lib.stdin.flush()

    # def excute(current):
    #     lib.stdin.write(bytes("excute %d\n"%current))
    #     lib.stdin.flush()
    #     result = lib.stdout.readline()
    #     x, y = map(result.split(" "), int)
    #     return x, y

    # x, y = excute(1)

    # print(x, y)

    # move(1, 7,7)

    # x, y = excute(1)

    # print(x, y)


finally:
    traceback.print_exc()
    print("so what???")
    input()
    